# -*- coding: utf-8 -*-

"""
    Forrest Cao   2021.08
"""

import sys, os, time, datetime
import logging
import json


def xprint(*args,**kwargs):
    logging.info(" ".join(map(str,args)), **kwargs)

def xpt(*args,**kwargs):
    import datetime
    ct = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')
    print( "[%s] "%ct[:-3] + " ".join(map(str,args)), **kwargs)

def is_vaild_date_str(date_str):
    try:
        if ":" in date_str:
            time.strptime(date_str, "%Y-%m-%d %H:%M:%S")
        else:
            time.strptime(date_str, "%Y-%m-%d")
        return True
    except:
        return False

# 2018-09-16 21:05:30
def get_now():
    return datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')

#字符串倒序
def reverse_str(_str):
    alist = list(_str)
    alist.reverse()
    s = ''
    return s.join(alist)

#格式化为,隔离的字符串
def format_t(_nf,_n=0):
    return format(_nf, '0,.%df'%_n)
